ABC265 D - Iroha and Haiku (New ABC Edition)
提出
code: python
n, p, q, r = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(1, n):
# print(wa)
# ジャンプできるか
# 0, 1, 4, 6, 8, 10, 13, 14, 18, 21, 23 # x x x x
for i in wa:
if i + p in wa and i + p + q in wa and i + p + q + r in wa:
print("Yes")
exit()
print("No")
テーマ
提出
code: python
n, p, q, r = map(int, input().split())
a = list(map(int, input().split()))
# 10 5 7 5
# 1 3 2 2 2 3 1 4 3 2
b = set()
c = 0
for v in a:
c += v
b.add(c)
# print(b)
# {1, 4, 6, 8, 10, 13, 14, 18, 21, 23}
t1 = p
t2 = t1 + q
t3 = t2 + r
if t1 in b and t2 in b and t3 in b:
print("Yes")
exit()
for v in b:
t1 = v + p
t2 = t1 + q
t3 = t2 + r
if t1 in b and t2 in b and t3 in b:
print("Yes")
exit()
print("No")